import {h, createTextVnode, getCurrentInstance, provide} from '../lib/guide-mini-vue.esm.mjs'
import Foo from './Foo.js'
window.self = null
export default {
  name: 'App',
  render() {
    window.self = this
    const p =  h('p', {
      class: 'red'
    }, this.msg)
    const h2 = h('h2', {
      class: 'blue',
    }, 'h2')
    const FooCom = h(Foo, {
      count: 1,
      onAdd:(a, b)=> {
        console.log('app-add', a, b)
      },
    },
        {
          header: (arg)=> {
            console.log(arg)
            return [h('header', {}, `header1age: ${arg.age}`), h('header', {}, 'header2'), createTextVnode('text')]
          },
          footer: (arg)=> h('header', {}, 'footer'),
        }
    )
    return h('div', {
      id: 'root',
    },[p, h2, FooCom])
  },
  setup() {
    provide('App-provide', 'app-provide111')
    const instance = getCurrentInstance()
    // console.log('App', instance)
    return {
      msg: 'mini-vue'
    }
  }
}
